#!/bin/sh
#
# by mhess
# thanks addy ;)

status=$(cmus-remote -Q | sed -nr '1 s/(^\w+)\s(\w+$)/\2/p')

case ${status} in
	playing)  xdotool key "ctrl+space" &> /dev/null
			  dunstify "Now Playing ♫" "$(cmus-remote -C 'format_print "%a - %t"')"
			  ;;
	stopped)  dunstify "cmus is stopped" ;;
	paused)   dunstify "cmus is paused" ;;
	*)        dunstify "cmus is not running"
esac
